package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.DisasterPreventDao;
import cn.topevery.garden.entity.po.DisasterPrevent;
import cn.topevery.garden.entity.query.DisasterPreventQuery;
import cn.topevery.garden.entity.vo.DisasterPreventVO;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 自然灾害防范保护
 *
 * @author code-generate
 * @date 2022-02-18
 */
@Service
public class DisasterPreventLogic extends BaseLogic<DisasterPrevent> {
    @Autowired
    DisasterPreventDao disasterPreventDao;

    @Override
    public BaseEntityDao<DisasterPrevent, Integer> getDao() {
        return disasterPreventDao;
    }

    

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<DisasterPreventVO> listPage(DisasterPreventQuery query) {
        return disasterPreventDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        disasterPreventDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param disasterPrevent 实体
     */
    public void saveOrUpdate(String userId, DisasterPrevent disasterPrevent){
        disasterPreventDao.saveOrUpdate(userId,disasterPrevent);
    }

    /**
         * 根据自定义列值来获取对象
         */
    public DisasterPrevent getEntityByColumn(String key, String value) {
        return disasterPreventDao.getEntityByColumn(key, value);
    }

    public List<Map<String, Object>> getDisasterNameList() {
        return disasterPreventDao.getDisasterNameList();
    }
}
